import { defineStore } from "pinia";
import { UserInfoState } from "../interface";
import piniaPersistConfig from "@/config/piniaPersist";

// MenuStore
export const UserInfoStore = defineStore({
	id: "UserInfoState",
	state: (): UserInfoState => ({
		username: "",
		nickname: "",
		avatar: ""
	}),
	getters: {},
	actions: {
		async setUsername(username: string) {
			this.username = username;
		},
		async setNickname(nickname: string) {
			this.nickname = nickname;
		},
		async setAvatar(avatar: string) {
			this.avatar = avatar;
		}
	},
	persist: piniaPersistConfig("UserInfoState")
});
